<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .contain {
            background: red;
            display: inline-flex;

        }

        .box {
            width: 100px;
            height: 50px;
            background: green;
        }
        .box2{
            width: 300px;
        }
    </style>
</head>

<body>
    <div class="contain">
        <div class="box">1</div>
        <div class="box box2">2</div>
        <div class="box">3</div>
        <div class="box">4</div>
    </div>
</body>

</html>